/**
 * Created by ayu on 2017/6/30.
 */
const webpack = require ('webpack');
const path = require ('path');
const publicPath = require ('./src/resources/TargetSource').url;
// const hotMiddlewareScript = 'webpack-hot-middleware/client?reload=false';
const devConfig = {
    entry  : {
        cinema: [ './src/web/client/cinema/index.js' ]
    },
    output : {
        filename  : './[name]/bundle.js',
        path      : path.resolve ('./src/web/public'),
        publicPath: publicPath
    },
    resolve: {
        extensions: [ '.js', '.jsx', '.css' ]
    },
    // devtool: 'source-map',
    // devtool: 'cheap-eval-source-map',
    devtool: false,
    module : {
        rules: [
            {
                test   : /\.(js|jsx)$/,
                use    : [ 'babel-loader' ],
                include:[
                    path.join(__dirname,'src/web/client')
                ],
            },
            {
                test: /\.css$/,
                use : [
                    'style-loader',
                    'css-loader',
                    'resolve-url-loader'
                ],
            },
            {
                test: /\.(png|jpg)$/,
                use : [ 'file-loader?name=img/[hash:8].[name].[ext]' ]
            }
        ]
    },
    plugins: [
        new webpack.optimize.UglifyJsPlugin({
            compress: {
                warnings: false
            }
        }),
        // new webpack.HotModuleReplacementPlugin (),
        // new webpack.NoEmitOnErrorsPlugin (),
    ]
};
module.exports = devConfig;